import request from '@/utils/request'
// 分页查询仓库
export function warehousePage(params) {
  return request({
    url: '/api/warehouse/page',
    method: 'get',
    params
  })
}
// 随机数
export function nextFn(txt) {
  return request({
    url: `/api/codeFactory/next/${txt}`,
    method: 'get'
  })
}
// 新增仓库
export function addWarehouse(data) {
  return request({
    url: '/api/warehouse',
    method: 'POST',
    data
  })
}
// 查询仓库
export function searchWarehouse(id) {
  return request({
    url: `/api/warehouse/${id}`,
    method: 'GET'
  })
}
// 修改仓库
export function editWarehouse(data) {
  return request({
    url: '/api/warehouse',
    method: 'PUT',
    data
  })
}
// 删除仓库
export function delWarehouse(id) {
  return request({
    url: `/api/warehouse?ids[]=${id}`,
    method: 'DELETE'
  })
}
// 分页查询库区详细信息
export function pageDetail(params) {
  return request({
    url: '/api/area/pageDetail',
    method: 'get',
    params
  })
}
// 查询全部仓库
export function warehouseList(params) {
  return request({
    url: `/api/warehouse/list`,
    method: 'GET',
    params
  })
}
// 查询库区
// /area/{id}
export function searchArea(id) {
  return request({
    url: `/api/area/${id}`,
    method: 'GET'
  })
}
// 查询全部库区
export function areaList(params) {
  return request({
    url: '/api/area/list',
    method: 'get',
    params
  })
}
// 新增库区
export function addArea(data) {
  return request({
    url: '/api/area',
    method: 'POST',
    data
  })
}
// 修改仓库
export function editArea(data) {
  return request({
    url: '/api/area',
    method: 'PUT',
    data
  })
}
// 删除库区
export function delArea(id) {
  return request({
    url: `/api/warehouse?ids[]=${id}`,
    method: 'DELETE'
  })
}

// 库位
export function locationPage(params) {
  return request({
    url: '/api/location/pageDetail',
    method: 'get',
    params
  })
}
export function editLocation(data) {
  return request({
    url: '/api/location',
    method: 'PUT',
    data
  })
}
export function delLocation(id) {
  return request({
    url: `/api/location?ids[]=${id}`,
    method: 'DELETE'
  })
}
export function addLocation(data) {
  return request({
    url: '/api/location',
    method: 'POST',
    data
  })
}
export function searchLocation(id) {
  return request({
    url: `/api/location/${id}`,
    method: 'GET'
  })
}
// /location/upload
export function uploadLocation(data) {
  return request({
    url: `/api/location/upload`,
    method: 'POST',
    data
  })
}
// 查询库区总览
export function overviewDetail(id) {
  return request({
    url: `/api/area/overview/${id}`,
    method: 'GET'
  })
}
// 查询全部库位详细信息
export function locationList(params) {
  return request({
    url: '/api/location/listDetail',
    method: 'GET',
    params
  })
}
// 货品
export function goodPage(params) {
  return request({
    url: '/api/goods/pageDetail',
    method: 'get',
    params
  })
}
export function editGoods(data) {
  return request({
    url: '/api/goods',
    method: 'PUT',
    data
  })
}
export function delGoods(id) {
  return request({
    url: `/api/goods?ids[]=${id}`,
    method: 'DELETE'
  })
}
// 新增货品管理
export function addGoods(data) {
  return request({
    url: '/api/goods',
    method: 'POST',
    data
  })
}
// 查询货品管理
export function searchGoods(id) {
  return request({
    url: `/api/goods/${id}`,
    method: 'GET'
  })
}
// 模糊查询货品类型
export function goodsTypeVague(params) {
  return request({
    url: `/api/goodsType/vague?params=${params}`,
    method: 'GET'
  })
}
// 模糊查询货主
export function ownerVague(params) {
  return request({
    url: `/api/owner/vague?params=${params}`,
    method: 'GET'
  })
}
// 货品类型
export function goodsTypePage(params) {
  return request({
    url: '/api/goodsType/page',
    method: 'get',
    params
  })
}
export function editGoodsType(data) {
  return request({
    url: '/api/goodsType',
    method: 'PUT',
    data
  })
}
export function delGoodsType(id) {
  return request({
    url: `/api/goodsType?ids[]=${id}`,
    method: 'DELETE'
  })
}
// 新增货品管理
export function addGoodsType(data) {
  return request({
    url: '/api/goodsType',
    method: 'POST',
    data
  })
}
